<template>
  <div class="accountPasswordSuggest"></div>
</template>

<script>
import { requestHttp, maccApi } from '@utils/index';
import { RjModal } from '@components';
export default {
  name: 'accountPasswordSuggest',
  data() {
    return {};
  },
  // components: {
  //   RjModal,
  // },
  created() {
    this.getPassWordSuggest();
  },
  methods: {
    // 获取密码相关建议
    async getPassWordSuggest() {
      const res = await requestHttp({
        api: maccApi.ACCOUNT_PASSWORDSUGGEST_GET_API,
        method: 'GET',
      });
      console.log(res, '密码提示');
      let needSuggest = sessionStorage.getItem('accountPwdSuggestHint');
      if (needSuggest == 'true') return;
      if (res.needModify) {
        let self = this;
        RjModal.confirm({
          title: this.$t('common.tip'),
          icon: '',
          onokcolose: true,
          content: this.$t('enetPwd.changePwd', [res.durationDay]),
          okText: this.$t('enetPwd.nowUpdate'),
          cancelText: this.$t('enetPwd.noUpdate'),
          onno: function () {
            sessionStorage.setItem('accountPwdSuggestHint', 'true');
          },
          onOk() {
            self.$router.replace({ path: '/private_accountsetting_menu' }); //路径需修改？
          },
        });
      }
    },
  },
};
</script>
